package com.rxnetwork.sample.application

import android.app.Application

import com.rxnetwork.manager.RxNetWork
import com.rxnetwork.sample.utils.interceptor.AppCacheInterceptor
import com.rxnetwork.sample.utils.interceptor.AppHeaderInterceptor
import com.rxnetwork.sample.utils.interceptor.AppLogInterceptor

import okhttp3.Cache

class App : Application() {

    override fun onCreate() {
        super.onCreate()
        /**
         * 建议这里设置统一设置参数
         */
        RxNetWork
                .instance
                .setTimeoutTime(30)
                .setLogInterceptor(AppLogInterceptor())
                .setHeaderInterceptor(AppHeaderInterceptor())
                .setCache(Cache(applicationContext.cacheDir, (1024 * 1024 * 10).toLong()))//缓存大小10M
                .setCacheInterceptor(AppCacheInterceptor(applicationContext))
                .setRetryOnConnectionFailure(true)
    }

}
